package com.todo.reward.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/2/12 22:35
 * @description
 */
@Getter
@AllArgsConstructor
public enum CouponWOWriteOffEnum {

    LOCK(1, "LOCK", "锁定"),
    WRITE_OFF_SUCCESS(2, "WRITE_OFF_SUCCESS", "核销成功"),
    WRITE_OFF_FAILED(3, "WRITE_OFF_FAILED", "核销失败"),
    ;

    private static Map<Integer, CouponWOWriteOffEnum> typeMap = Arrays
            .stream(CouponWOWriteOffEnum.values())
            .collect(Collectors.toMap(CouponWOWriteOffEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static CouponWOWriteOffEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
